package TCP;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.SocketHandler;

public class Sever {
    public static void main(String[] args) throws IOException {

        //作为服务器的一段
        ServerSocket ss = new ServerSocket(10005);

        Socket socket = ss.accept();//获得客户端的对象
        InputStream is = socket.getInputStream();
        InputStreamReader isr=new InputStreamReader(is);
        BufferedReader br=new BufferedReader(isr);
        int b;
        while ((b=br.read())!=-1)
        {
            System.out.println((char)b);
        }
        socket.close();
        ss.close();
    }
}
